package com.example.news.controller;

import com.example.news.bean.User;
import com.example.news.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 用户信息接口
 */
@RestController
public class UserController {
    @Autowired
    UserService userService;
    /**
     * 登录
     * @param account
     * @param password
     * @return
     */
    @RequestMapping("/login")
    public Map<String,Object> login(String account, String password){
        return userService.login(account,password);
    }


    /**
     * 注册
     * @return
     */
    @RequestMapping("/register")
    public  Map<String,Object> register(User user){
        return userService.register(user);
    }
}
